/*
 * @Description: 
 * @Author: Junhuang
 * @Date: 2022-02-08 11:04:34
 * @LastEditTime: 2022-03-18 13:36:01
 * @LastEditors: Junhuang
 * @Reference: 路由页面
 */
'use strict';

/**
 * @param {Egg.Application} app - egg application
 */
module.exports = app => {
  const { router, controller } = app;
  router.get('/', controller.home.index);
  router.get('/index', controller.home.index);
  router.get('/bad', controller.home.bad);
  router.get('/cate/:cate_id/video/:page', controller.home.cate_page);

  // 用户相关
  router.post('/reg', controller.user.reg);
  router.post('/login', controller.user.login);
  router.post('/logout', controller.user.logout);
  router.post('/user/follow', controller.user.follow);
  router.post('/user/unfollow', controller.user.unfollow);
  router.get('/user/followed', controller.user.isFollowed);
  router.get('/user/follows/:page', controller.user.follows);
  router.get('/user/fans/:page', controller.user.fans);
  router.get('/user/statistics', controller.user.statistics);
  router.get('/user/user_info', controller.user.user_info);
  router.post('/user/fan_drop', controller.user.dropFan);

  // 目录相关
  router.get('/category/:category_id/video/:page', controller.video.list);
  router.get('/category', controller.category.index);


  //作品(video)相关
  router.post('/video/destroy', controller.video.del);
  router.get('/video/:id/edit', controller.video.edit);
  router.post('/video', controller.video.save);
  router.post('/video/:id', controller.video.update);
  router.get('/video_search/:page', controller.video.search);
  // 获取作品详细信息
  router.get('/video_read/:id', controller.video.read);
  router.get('/video_read_auth/:id', controller.video.read_auth);

  // 获取作品基本信息
  router.get('/video_get/:id', controller.video.get);


  //upload
  router.post('/upload', controller.file.upload);

  //指定用户的作品列表
  router.get('/video_list/:page', controller.video.index);

  // 注意videoDetail的驼峰式写法
  router.get('/video_detail_list', controller.videoDetail.index);
  router.post('/video_detail', controller.videoDetail.save);
  // 注意/video_detail/destroy 与 动态路由/video_detail/:id 形式相似，因此要写到动态路由前面
  router.post('/video_detail/destroy', controller.videoDetail.destroy);
  router.post('/video_detail/:id', controller.videoDetail.update);

  //vod
  router.post('/vod/sign', controller.vod.sign);

  //收藏
  router.post('/fava', controller.fava.fava);
  router.post('/unfava', controller.fava.unfava);
  router.get('/fava_list/:page', controller.fava.list);


  //评论
  router.post('/comment', controller.comment.save);
  router.get('/video_comment/:video_id', controller.comment.comment);
};
